package com.young.bs.vote.model;

import com.young.common.core.excel.ExcelColumn;
import java.util.Date;
/**
* 投票主信息实体类
* Created by admin on 2019-3-19.
*/
public class VoteInfo{

    @ExcelColumn(value = "投票信息编号", order = 1)
    private String id;//投票信息编号
    @ExcelColumn(value = "标题", order = 2)
    private String title;//标题
    @ExcelColumn(value = "内容", order = 3)
    private String content;//内容
    @ExcelColumn(value = "起始时间", order = 4)
    private Date startTime;//起始时间
    @ExcelColumn(value = "结束时间", order = 5)
    private Date endTime;//结束时间
    @ExcelColumn(value = "创建时间", order = 6)
    private Date createTime;//创建时间
    private Date createTime2;//创建时间,按时间检索时作为结束时间使用
    @ExcelColumn(value = "修改时间", order = 7)
    private Date updateTime;//修改时间
    @ExcelColumn(value = "创建人", order = 8)
    private String createUserId;//创建人
    @ExcelColumn(value = "修改人", order = 9)
    private String updateUserId;//修改人
    @ExcelColumn(value = "数据版本", order = 10)
    private Integer dataVersion;//数据版本
    @ExcelColumn(value = "删除标记", order = 11)
    private Integer trashFlag;//删除标记
    @ExcelColumn(value = "时间戳", order = 12)
    private Date ts;//时间戳

    private String userId;//用户id

    private Date currentTime;//当前时间

    private VoteResult voteResult;//投票结果

    private boolean canVote;//是否可以投票

    private String orderBy;//排序字段
    private String orderType;//排序类型,升序asc/降序desc

    /**
     * 更新投票标记
     * @return
     */
    public boolean refreshCanVoteFlag() {
        if (this.trashFlag != null && 0 == this.trashFlag && this.startTime != null && this.endTime != null) {
            Date now = new Date();
            this.canVote = now.before(this.endTime) && this.startTime.before(now);
            return this.canVote;
        }
        return false;
    }

    public VoteInfo(){
        super();
    }

    public String getUserId() {
        return userId;
    }

    public void setUserId(String userId) {
        this.userId = userId;
    }

    public VoteResult getVoteResult() {
        return voteResult;
    }

    public void setVoteResult(VoteResult voteResult) {
        this.voteResult = voteResult;
    }

    public Date getCurrentTime() {
        return currentTime;
    }

    public void setCurrentTime(Date currentTime) {
        this.currentTime = currentTime;
    }

    public String getId() {
    return id;
    }
    public void setId(String id) {
    this.id = id;
    }
    public String getTitle() {
    return title;
    }
    public void setTitle(String title) {
    this.title = title;
    }
    public String getContent() {
    return content;
    }
    public void setContent(String content) {
    this.content = content;
    }
    public Date getStartTime() {
    return startTime;
    }
    public void setStartTime(Date startTime) {
    this.startTime = startTime;
    }
    public Date getEndTime() {
    return endTime;
    }
    public void setEndTime(Date endTime) {
    this.endTime = endTime;
    }
    public Date getCreateTime() {
    return createTime;
    }
    public void setCreateTime(Date createTime) {
    this.createTime = createTime;
    }
    public Date getCreateTime2() {
    return createTime2;
    }
    public void setCreateTime2(Date createTime2) {
    this.createTime2 = createTime2;
    }
    public Date getUpdateTime() {
    return updateTime;
    }
    public void setUpdateTime(Date updateTime) {
    this.updateTime = updateTime;
    }
    public String getCreateUserId() {
    return createUserId;
    }
    public void setCreateUserId(String createUserId) {
    this.createUserId = createUserId;
    }
    public String getUpdateUserId() {
    return updateUserId;
    }
    public void setUpdateUserId(String updateUserId) {
    this.updateUserId = updateUserId;
    }
    public Integer getDataVersion() {
    return dataVersion;
    }
    public void setDataVersion(Integer dataVersion) {
    this.dataVersion = dataVersion;
    }
    public Integer getTrashFlag() {
    return trashFlag;
    }
    public void setTrashFlag(Integer trashFlag) {
    this.trashFlag = trashFlag;
    }
    public Date getTs() {
    return ts;
    }
    public void setTs(Date ts) {
    this.ts = ts;
    }

    public String getOrderBy() {
        return orderBy;
    }

    public void setOrderBy(String orderBy) {
        this.orderBy = orderBy;
    }

    public String getOrderType() {
        return orderType;
    }

    public void setOrderType(String orderType) {
        this.orderType = orderType;
    }

    public boolean isCanVote() {
        return canVote;
    }

    public void setCanVote(boolean canVote) {
        this.canVote = canVote;
    }
}